package com.hp.controller;

import com.hp.entity.DrugType;
import com.hp.service.TypeService;
import com.hp.util.JsonData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Date;

@Controller
@RequestMapping("/type")
public class TypeController {
    @Resource
    TypeService typeService;

    @RequestMapping("/add")
    @ResponseBody
    public Object add(DrugType obj){
        Date data =new Date();
        obj.setCreate_datetime(data);
        int i=typeService.add(obj);
        System.out.println(i);
        return JsonData.buildSuccess(i>0?"添加成功！":"添加失败！");
    }
}
